using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace DealerPlatform.Web.Controllers.Extensions
{
    public static class SystemExtensions
    {
        /// <summary>
        /// 不好用
        /// </summary>
        /// <param name="services"></param>
        /// <returns></returns>
        public static IConfiguration GetConfiguration(this IServiceCollection services)
        {
            var configuration = services.FirstOrDefault(d=>d.ServiceType == typeof(IConfiguration));
            var config = services.FirstOrDefault(d=>d.ServiceType == typeof(IConfiguration))?.ImplementationInstance;
            return (IConfiguration)config;
        }
    }
}